﻿@using nwrole.Supervisor.web.Models
@model nwrole.Supervisor.web.Models.HomeIndexViewModel

@{
    ViewBag.Title = "Index";
}

<h2>Supervisor @Model.SupervisorData.DisplayName</h2>
<br/>
<table class="box">
    <tr>
        <th>Name</th>
        <th>Enabled</th>
        <th>Last pulse</th>
        <th>Pulse message</th>
        <th>Id</th>
        @*<th></th>*@
    </tr>
    @foreach(var service in Model.Services)
    {
        <tr class="service-row @(service.Status.ToString() + "row")">
            <td class="form">
                @service.ServiceData.Name
            </td>
            <td class="form">
                @service.ServiceData.Enabled
            </td>
            <td class="form">
                @service.LastPulseDate
            </td>
            <td class="form">
                @service.LastPulseMessage
            </td>
            <td class="form">
                @service.ServiceData.Id
            </td>
            @*<td>
                @if (service.ServiceData.Enabled)
                {
                    @Html.ActionLink("Restart", "RestartService", new {id = service.ServiceData.Id})
                    @: | 
                    @Html.ActionLink("Stop", "StopService", new { id = service.ServiceData.Id })
                } else
                {
                    @Html.ActionLink("Start", "StartService", new { id = service.ServiceData.Id })
                }
            </td>*@
        </tr>
        
        foreach (var plugin in service.Plugins)
        {
            <tr class="plugin-row @(plugin.Status.ToString() + "row")">
                <td class="form">
                    @plugin.PluginData.DisplayName
                </td>
                <td class="form">
                    @plugin.PluginData.Enabled
                </td>
                <td class="form">
                    @plugin.LastPulseDate
                </td>
                <td class="form">
                    @plugin.LastPulseMessage
                </td>
                <td class="form">
                    @plugin.PluginData.Id
                </td>
                @*<td>
                    
                </td>*@
            </tr>
        }
    

    @*<div class="plugin-div">
        <table class="box">
            <tr>
                <th>Name</th>
                <th>Enabled</th>
                <th>Last pulse</th>
                <th>Pulse message</th>
                <th>Id</th>
            </tr>
            @foreach (var plugin in service.Plugins)
            {
                <tr>
                    <td class="form">
                        @plugin.PluginData.DisplayName
                    </td>
                    <td class="form">
                        @plugin.PluginData.Enabled
                    </td>
                    <td class="form">
                        @plugin.LastPulseDate
                    </td>
                    <td class="form">
                        @plugin.LastPulseMessage
                    </td>
                    <td class="form">
                        @plugin.PluginData.Id
                    </td>
                </tr>
            }
        </table>
    </div>*@
    }
</table>

